package main

import (
	"github.com/astaxie/beego"
	_ "router"
	_ "github.com/go-sql-driver/mysql"
	"github.com/astaxie/beego/orm"
	"fmt"
	"reflect"
)

type User struct{
	Id int
	name string
}

func main() {
	orm.Debug = true
	orm.RegisterDataBase("default", "mysql", "root:root@/golang?charset=utf8")
	var o = orm.NewOrm()

	var maps []User
	num, err := o.Raw("SELECT * FROM user").QueryRows(&maps)
	if err == nil && num > 0 {
		for _,v :=range maps{
			fmt.Println(reflect.TypeOf(v.Id))
		}
	}
	// 设置日志文件路径
	beego.SetLogger("file", `{"filename":"logs/mes.log"}`)
	beego.Run()
}
